<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 当我们在注册按键事件的时候，如果给事件跟上了键值修饰符则当前的按键事件只会在特定的建被按下的时候触发 -->
        <!-- <input type="text" @keyup.13="keyUp" v-model="msg"> -->
        <!-- <input type="text" @keyup.enter="keyUp" v-model="msg"> -->
        <input type="text" @keyup.zdm="keyUp" v-model="msg">
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        Vue.config.keyCodes.leftctrl = 17;
        Vue.config.keyCodes.zdm = 17;

        var vm = new Vue({
            el: "#app",
            data: {
                msg: ""
            },
            methods: {
                keyUp(e){
                    // console.log(e.keyCode)
                    alert(this.msg);
                    // //判断用户按下的是否是回车键
                    // if(e.keyCode == 13){
                    //     //如果是，就将文本框的内容alert出来
                    //     alert(this.msg)
                    // }
                }
            }
        })
    </script>
</body>

</html>